using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Objects;
using BAL;

public partial class Admin_UCControls_UCDuyet_PhuongThucThanhToan : System.Web.UI.UserControl
{
    public static Duyet item;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DanhSachChoDuyet itemChoDuyet = new DanhSachChoDuyet();
            itemChoDuyet = (DanhSachChoDuyet)Session["ItemDuyet"];

            item = new Duyet();

            if (itemChoDuyet != null)
            {
                item = BALDuyet.GetById(itemChoDuyet.Id);
            }

            if (item != null)
            {
                DangKy itemDangKy = new DangKy();
                itemDangKy = BALDangKy.GetById(item.IdDangKy);

                if (itemDangKy.IdPhuongThucThanhToan > 0)
                {
                    PhuongThucThanhToan itemPhuongThucThanhToan = new PhuongThucThanhToan();
                    itemPhuongThucThanhToan = BALPhuongThucThanhToan.GetById(itemDangKy.IdPhuongThucThanhToan);
                    lblHinhThucThanhToan.Text = itemPhuongThucThanhToan.HinhThuc.ToString();
                }

                if (itemDangKy.IdChiNhanh > 0)
                {
                    ChiNhanh itemChiNhanh = new ChiNhanh();
                    itemChiNhanh = BALChiNhanh.GetById(itemDangKy.IdChiNhanh);
                    lblChiNhanh.Text = itemChiNhanh.Ten.ToString();
                }

                if (itemDangKy.IdKhachHangNhanTheKhac > 0)
                {
                    GetThongTinKhachHangNhanThe(itemDangKy.IdKhachHangNhanTheKhac);
                }

            }
        }
    }

    public void GetThongTinKhachHangNhanThe(int idkhachhang)
    {
        if (idkhachhang > 0)
        {
            KhachHangNhanTheKhac itemKhachHangTrenTheKhac = new KhachHangNhanTheKhac();
            itemKhachHangTrenTheKhac = BALKhachHangNhanTheKhac.GetById(idkhachhang);

            lblNguoiNhan.Text = itemKhachHangTrenTheKhac.NguoiNhan.ToString();
            lblDiaChi2.Text = itemKhachHangTrenTheKhac.DiaChi.ToString();
            lblSoDienThoai2.Text = itemKhachHangTrenTheKhac.SoDienThoai.ToString();
            lblThongDiep.Text = itemKhachHangTrenTheKhac.ThongDiep.ToString();
        }
    }
}
